home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d16
/
netwin3.arc
/
NETWORK
< prev
Wrap
Text File
|
1990-09-04
|
11KB
|
277 lines
**********************************************************************
* Developing Network Applications for Windows 3.00 *
**********************************************************************
As local area networks (LANs) become increasingly common, application
developers should ensure that their applications run properly in a
network environment.
There are two areas that developers should keep in mind:
- Applications should be well behaved when shared by multiple users.
- Applications that access network software directly might require
special measures to be compatible with protected (standard or 386
enhanced) mode.
This document discusses each of these areas.
=======================================================================
BEING SHARED BY MULTIPLE USERS
=======================================================================
Many corporations are choosing to have their computer users share a
single copy of an application that resides on a network server.
Microsoft(R) Windows(TM) version 3.0 can be run this way. The Windows
Setup /n (network) option configures the user's system so that most
Windows files are used directly off the network, while the user's
personal files and configuration information are stored in a private
Windows directory. (See the "Microsoft Windows User's Guide" for more
information on using a shared copy of Windows.)
If you intend to allow shared copies of your application, you must
make sure that two users running the same application will not
interfere with each other. The following sections present rules that
should help you plan your application for network support.
CREATING PERMANENT FILES
========================
Many applications store configuration files in the same directory as
the application's own executable file. This method will not work for
multiple users, because the application will store each user's
information in the same directory, overwriting other users'
information.
Instead, the application should use the GetWindowsDirectory function
to find the user's private Windows directory. This location is
guaranteed to be unique for each user.
Refer to the "Microsoft Windows Software Development Kit Reference"
for more information on the GetWindowsDirectory function.
CREATING TEMPORARY FILES
========================
When creating temporary files, use the GetTempFilename function to
determine the name and location of the file. This function will ensure
that temporary filenames will not conflict, even if multiple users are
sharing the same temporary storage directory.
USING PROFILE STRINGS
=====================
Profile and configuration information is usually stored in
initialization (.INI) files using Windows functions such as
WriteProfileString. These functions fall into two categories: those
that access WIN.INI, and those that access another .INI file specified
by the program.
The following functions access WIN.INI:
- GetProfileString
- GetProfileInt
- WriteProfileString
Since each user has a unique copy of WIN.INI, these functions can be
safely used even when the application is being shared by more than one
user.
The following functions access other initialization files:
- GetPrivateProfileString
- GetPrivateProfileInt
- WritePrivateProfileString
These functions behave similarly to the WIN.INI functions, except that
the application specifies the name of the private initialization file.
When using these functions, you should specify the name of the file,
but not a complete pathname. (For example, MYAPP.INI instead of
C:\MYAPP\MYAPP.INI.) By default, the file will be located in the
user's private Windows directory; specifying a full pathname could
give multiple users access to the same file.
The exception to this rule would be initialization files that need to
be shared between all users. Make sure that such files cannot be left
in an inconsistent state if multiple users update them simultaneously.
See the Windows SDK Reference for a full description of the
initialization file functions.
=======================================================================
CALLING NETWORK SOFTWARE IN PROTECTED MODE
=======================================================================
Windows applications running in protected mode require special support
whenever they make a function call to real-mode software. This
includes calls to DOS, the BIOS, or a network. Non-Windows
applications running with Windows do not require this special support,
however, since non-Windows applications running with Windows always
run in real or virtual 8086 mode.
The main support required is called "API mapping." If the arguments to
the call include pointers to data, that data should be copied down
into the first 1 MB of address space so that the real-mode software can
access it. The processor is then switched into real or virtual-8086
mode so that the real-mode software can process the call. Finally,
when that call returns, any data it modified is copied back up to the
caller's protected-mode address.
Fortunately, most applications interact with the network only
indirectly, by using DOS functions to manipulate files on redirected
drive letters, or by using DOS or BIOS calls to print to a remote
printer using redirected printer ports. Windows applications can
continue to perform these functions normally, because Windows
automatically maps standard DOS and BIOS calls.
However, some applications need to use functions that are specific to
a particular network or networking protocol. Some part of software
must map these API, and in some cases this may require special
procedures on the part of the programmer.
The remainder of this document describes programming considerations
for designing Windows applications that use the following networking
protocols and networks:
- Microsoft Networks and DOS network functions
- NetBIOS functions
- Microsoft LAN Manager-based networks
- Novell NetWare
- Ungermann-Bass Net/One
- Banyan VINES
MICROSOFT NETWORKS AND DOS NETWORK FUNCTIONS
============================================
Many networks on the market today are based upon the Microsoft Network
standard, also known as MS-NET. These networks support a set of
standard DOS functions that perform network activities, such as
redirecting drive letters.
Windows automatically handles these DOS functions. However, in order
to maintain compatibility with future Windows products, your
application should not make DOS calls by executing an INT 21H
instruction. Instead, it should set up all the registers for executing
the INT 21H and then make a far call to the Windows DOS3Call function.
See the Windows SDK Reference for a full description of the DOS3Call
function. See the "MS-DOS Encyclopedia," available from Microsoft
Press, for more information on Microsoft Network functions.
NETBIOS FUNCTIONS
=================
NetBIOS is the most widely used networking API. These functions are
normally called using INT 5CH. Windows handles most NetBIOS functions.
However, in order to maintain compatibility with future Windows
products, the application should not make the NetBIOS call by
executing an INT 5CH instruction. Instead, it should set up all the
registers for executing the INT 5CH, and then make a far call to the
Windows NetBIOSCall function.
The following rarely-used NetBIOS functions are not supported:
71H Send.No.Ack
72H Chain.Send.No.Ack
73H Lan.Status.Alert
78H Find.Name
79H Trace
See the Windows SDK Reference for a full description of the
NetBIOSCall function. See the "IBM Local Area Network Technical
Reference" for more information on NetBIOS.
LAN MANAGER-BASED NETWORKS
==========================
Networks based on Microsoft LAN Manager can be installed in either
Basic or Enhanced versions.
All versions of LAN Manager support MS-NET and NetBIOS functions.
However, if you are running LAN Manager Enhanced with the API option,
applications can also use a powerful set of networking functions.
Non-Windows applications can call these functions by linking with
DOSNET.LIB, a static library provided with their network software.
Windows applications, however, must use dynamic-link libraries called
NETAPI.DLL and PMSPL.DLL. They are distributed on every LAN Manager
version 2.0 Enhanced workstation. However, these DLLs will not run on
LAN Manager 1.x or 2.0 Basic, so these functions may only be used on
LAN Manager 2.0 Enhanced.
See the "Microsoft LAN Manager Programmer's Reference" for more details
on writing Windows applications for LAN Manager.
NOVELL NETWARE
==============
Novell NetWare supports MS-NET and, optionally, NETBIOS functions,
which are described earlier in this document.
In addition, Novell NetWare also supports the NetWare and IPX/SPX API
sets, all based on INT 21H.
Windows applications can make NetWare calls, but not by executing the
INT 21H directly because this method is not supported in all Windows
operating modes. Instead, you should replace the INT 21H instruction
with a far call to the NetWareRequest function. This function is
exported by name from the NetWare DLL, and should be imported to your
module-definition (.DEF) file as NetWare.NetWareRequest.
Windows applications cannot make IPX/SPX calls at this time, although
Novell plans to make this support available in a future release. If
you need more information, contact your usual Novell support channel.
UNGERMANN-BASS NET/ONE
======================
Ungermann-Bass Net/One is based upon the Microsoft Network standard.
It supports standard MS-NET and most NetBIOS functions, which are
described earlier in this document.
Net/One also supports private extensions to the NetBIOS function set
(functions 72H-7DH). These functions are supported by the standard
Windows product. You can call these functions as you would standard
NetBIOS functions, by making a far call to the NetBIOSCall function.
BANYAN VINES
============
Banyan VINES supports the standard MS-NET and, optionally, NetBIOS
functions. There is also a toolkit for applications that write
directly to the VINES API.
Windows applications can call the MS-NET and NETBIOS functions as
previously described.
VINES version 4.0 does not support Windows applications calling the
VINES API directly, but Banyan does intend to make this support
available in VINES 4.1. For more information, contact your Banyan
support channel.
Microsoft and MS-DOS are registered trademarks and Windows is a
trademark of Microsoft Corporation.
Banyan and VINES are registered trademarks of Banyan Systems, Inc.
Novell and NetWare are registered trademarks of Novell, Inc.
Ungermann-Bass and Net/One are registered trademarks of Ungermann-
Bass, Inc.
IBM is a registered trademark of International Business Machines
Corporation.